import 'package:ai/util/CommonUtils.dart';
import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';

import '../../config/Config.dart';

@RoutePage()
class OfficePage extends StatefulWidget {
  const OfficePage({super.key});

  @override
  State<OfficePage> createState() {
    return _OfficePageState();
  }
}

class _OfficePageState extends State<OfficePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBodyBehindAppBar: true,
      backgroundColor: Config.colorF5,
      body: SingleChildScrollView(
        child: Column(
          children: [
            Stack(
              children: [
                CommonUtils.getImageAsset("work_fg_bg", fit: BoxFit.fitWidth),
                Positioned(
                  bottom: 0,
                  width: MediaQuery.of(context).size.width,
                  child: Container(
                    height: 48,
                    padding: const EdgeInsets.symmetric(horizontal: 16),
                    child: TextField(
                      enabled: false,
                      decoration: InputDecoration(
                          hintText: "快速搜索工具",
                          hintStyle: TextStyle(
                            fontSize: 14,
                            color: Config.color636977,
                          ),
                          disabledBorder: OutlineInputBorder(
                            borderSide:
                                BorderSide(color: Config.colorF8f9fd, width: 2),
                            borderRadius:
                                const BorderRadius.all(Radius.circular(24)),
                          ),
                          suffixIcon: Icon(
                            Icons.search_rounded,
                            color: Config.color4,
                          )),
                    ),
                  ),
                ),
              ],
            ),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 8),
              child: GridView.builder(
                gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                  crossAxisCount: 2,
                  childAspectRatio: 3 / 1.3,
                ),
                itemCount: 59,
                shrinkWrap: true,
                physics: const NeverScrollableScrollPhysics(),
                itemBuilder: (context, index) {
                  return Card(
                    color: Colors.white,
                    elevation: 2,
                    child: Padding(
                      padding: const EdgeInsets.all(8),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          CommonUtils.getImageAsset("work_ass_icon_htmb",
                              width: 48),
                          const SizedBox(
                            width: 8,
                          ),
                          Expanded(
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.start,
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                const SizedBox(
                                  height: 8,
                                ),
                                Text(
                                  "公文写作",
                                  style: TextStyle(
                                    fontSize: 12,
                                    color: Config.color34,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                                const SizedBox(
                                  height: 8,
                                ),
                                Text(
                                  "格式完成的公格式完成的公格式完成的公",
                                  overflow: TextOverflow.ellipsis,
                                  style: TextStyle(
                                    color: Config.colorA9,
                                    fontSize: 10,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  );
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
